home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-20 | 6.1 KB | 219 lines | [TEXT/MPS ] |
- // Text of project DatePick written on 11/20/95 at 5:51 PM
- // Beginning of file protoDatePicker
-
- // Before Script for "protoDatePicker"
- // Copyright 1993-1995 Apple Computer, Inc.
-
-
- protoDatePicker :=
- {viewFlags: 1,
- viewFormat: nil,
- viewBounds: {left: 0, top: 0, right: 120, bottom: 100},
- monthChangedScript:
- func()
- begin
- // This will be inherited by the child month view and called every time
- // the user taps on a new day. It *must* be here because the user can
- // tap on days at the end or beginning of the previous or next month
- // (the blank spaces on the view) and actually change the date!
- // If this script isn't here to update the view and the title string,
- // the month with change but the display won't--confusing the heck out of
- // people.
- :Dirty();
- :SetTitle();
- end,
- monthYearSpec:
- GetDateStringSpec([
- [kElementMonth, kFormatLong],
- [kElementYear, kFormatLong]]),
- SetTitle:
- // This function updates the month/year label. It should be called
- // whenever the user changes the date.
-
- func()
- begin
- SetValue(monthYearLabel, 'text,
- LongDateStr(selectedDates[0], monthYearSpec));
- end,
- viewSetupDoneScript:
- func()
- begin
- if NOT selectedDates exists then
- self.selectedDates := [Time()]; // initialize selectedDates to current
- :SetTitle();
- end,
- Refresh:
- // This allows scripts outside the proto to have a nice entry point for
- // getting the picker refreshed when the selectedDates array changes.
-
- func()
- begin
- monthView:Dirty();
- :SetTitle();
- end,
- debug: "protoDatePicker",
- viewClass: 74
- };
-
- monthYearLabel :=
- {text: "",
- viewBounds: {left: 0, top: 0, right: 0, bottom: 15},
- viewFlags: 3,
- viewJustify: 8388662,
- debug: "monthYearLabel",
- _proto: @218
- };
- AddStepForm(protoDatePicker, monthYearLabel);
- StepDeclare(protoDatePicker, monthYearLabel, 'monthYearLabel);
-
-
-
- previousMonthButton :=
- {viewBounds: {left: 0, top: 0, right: 15, bottom: 15},
- viewSetupFormScript:
- func()
- begin
- // initialize the icon from the system bitmap via a magic pointer.
- self.icon := ROM_leftBitmap; // leftBitmap
- end,
- viewFlags: 515,
- viewJustify: 6,
- viewFormat: 1,
- buttonPressedScript:
- func()
- begin
- // move to the previous month, and make sure the views redraw.
- selectedDates[0] := IncrementMonth(selectedDates[0], -1);
- monthView:dirty();
- :SetTitle();
-
- // have to call RefreshViews because this is the buttonPressedScript,
- // the view otherwise wouldn't get refreshed until the user lifted the
- // pen! If you had done this in the buttonClickScript instead, you
- // could skip the RefreshViews() call.
- RefreshViews();
- end,
- icon: nil,
- debug: "previousMonthButton",
- _proto: @198
- };
- AddStepForm(protoDatePicker, previousMonthButton);
-
-
-
- nextMonthButton :=
- {icon: nil,
- viewBounds: {top: 0, left: -15, right: 0, bottom: 15},
- viewSetupFormScript:
- func()
- begin
- // initialize the bitmap from the system ROMs via a magic pointer.
- self.icon := ROM_rightBitmap; // rightBitmap
- end,
- viewFlags: 515,
- viewFormat: 1,
- viewJustify: 38,
- buttonPressedScript:
- func()
- begin
- // move to the previous month, and make sure the views redraw.
- selectedDates[0] := IncrementMonth(selectedDates[0], 1);
- monthView:dirty();
- :SetTitle();
-
- // have to call RefreshViews because this is the buttonPressedScript,
- // the view otherwise wouldn't get refreshed until the user lifted the
- // pen! If you had done this in the buttonClickScript instead, you
- // could skip the RefreshViews() call.
- RefreshViews();
- end,
- copyright: "Copyright 1993-1994 Apple Computer, Inc.",
- debug: "nextMonthButton",
- _proto: @198
- };
- AddStepForm(protoDatePicker, nextMonthButton);
-
-
-
- monthView :=
- {viewBounds: {top: 15, left: 1, right: -1, bottom: -1},
- viewFlags: 513,
- viewFormat: nil,
- labelFont: ROM_fontSystem9Bold,
- dateFont: ROM_fontSystem9,
- viewJustify: 246,
- singleDay: true,
- debug: "monthView",
- viewClass: 80
- };
- AddStepForm(protoDatePicker, monthView);
- StepDeclare(protoDatePicker, monthView, 'monthView);
-
-
-
-
- constant |layout_protoDatePicker| := protoDatePicker;
- // End of file protoDatePicker
- // Beginning of file DatePick.t
-
- // Before Script for "monthPickerExample"
- //Copyright 1993-1994 Apple Computer, Inc.
-
-
- monthPickerExample :=
- {title: "clMonthView Sample",
- viewBounds: {top: 0, left: 0, right: 240, bottom: 335},
- viewFlags: 516,
- selectedDates: [],
- viewSetupFormScript:
- func()
- begin
- local b := GetAppParams();
- constant kMaxWidth := 240;
- constant kMaxHeight := 336;
-
- viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop,
- Min(b.appAreaWidth, kMaxWidth),
- Min(b.appAreaHeight, kMaxHeight) );
-
-
- selectedDates := [Time()];
-
- end,
- debug: "monthPickerExample",
- _proto: @157
- };
-
- datePicker :=
- {viewBounds: {left: 41, top: 25, right: 161, bottom: 113},
- viewFormat: 336,
- debug: "datePicker",
- _proto: protoDatePicker
- };
- AddStepForm(monthPickerExample, datePicker);
- StepDeclare(monthPickerExample, datePicker, 'datePicker);
-
-
-
- _view000 :=
- {text: "Today",
- buttonClickScript:
- func()
- begin
- selectedDates := [Time()]; // get current date/time
- datePicker:Refresh();
- end,
- viewBounds: {left: 44, top: 124, right: 160, bottom: 144},
- _proto: @226
- };
- AddStepForm(monthPickerExample, _view000);
-
-
-
-
- constant |layout_DatePick.t| := monthPickerExample;
- // End of file DatePick.t
-
-
-
-